/**
 * @description 操作人员管理
 * @author 骆子豪
 * @date 2025-07-02
 */

import request from '@/utils/request'

/**
 * @description 获取操作人员列表
 * @param {Object} params 查询参数
 */

export const fetchOperatorList = (params) => {
  return request({
    url: '/dealer/pzDealerOperator/getPzDealerOperatorListByDealerId',
    method: 'post',
    data: params,
  })
}

/**
 * @description 删除操作人员
 * @param {Object} id 操作人员ID
 * @returns 删除结果
 */
export const postDeleteOperator = (id) => {
  return request({
    url: `/dealer/pzDealerOperator/deletePzDealerOperator?id=${id}`,
    method: 'post',
  })
}

/**
 * @description 查看操作人员
 * @param {Object} id 操作人员ID
 * @returns 操作人员信息
 */
export const fetchOperatorInfo = (id) => {
  return request({
    url: `/dealer/pzDealerOperator/viewPzDealerOperator?dealerOperatorId=${id}`,
    method: 'post',
  })
}

/**
 * @description 添加操作人员
 * @param {Object} data 操作人员信息
 * @returns 添加结果
 */
export const postAddOperator = (data) => {
  return request({
    url: '/dealer/pzDealerOperator/savePzDealerOperator',
    method: 'post',
    data,
  })
}

/**
 * @description 重置密码
 * @param {Object} id 操作人员ID
 * @returns 重置结果
 */
export const postResetPassword = (id) => {
  return request({
    url: `/dealer/pzDealerOperator/resetPassword?dealerOperatorId=${id}`,
    method: 'post',
  })
}

/**
 * @description 修改自己的密码
 * @param {Object} data 修改密码信息
 * @returns 修改结果
 */
export const postUpdatePassword = (data) => {
  return request({
    url: '/dealer/pzDealerOperator/updateSelfPassword',
    method: 'post',
    params: data,
  })
}
